'use strict';
// Copyright 2014 Blueant Inc. All Rights Reserved.

/**
 * @fileoverview 击杀$1不少于$2个
 * @author sundbcn@gmail.com (sun debing)
 */

var _ = require('lodash');

var CopyCondition = function () {

};

/**
 * 验证
 */
CopyCondition.prototype.getProgress = function (condition, record, damage_build_list, data) {
    var kill_soldier_list = data.kill_soldier_list || [];
    var kill_soldier_num = 0;
    _.some(kill_soldier_list, function (kill_soldier) {
        if (kill_soldier.soldier_type == condition.param1) {
            kill_soldier_num = kill_soldier.num;
            return true;
        }
    });
    return {
        progress: kill_soldier_num,
        total_progress: condition.param2,
        is_pass: Number(kill_soldier_num >= condition.param2)
    };
};

module.exports = new CopyCondition();
